//package com.zhangtai.utils;
//
//import com.alibaba.excel.ExcelWriter;
//import com.alibaba.excel.metadata.BaseRowModel;
//import com.alibaba.excel.metadata.Sheet;
//import com.alibaba.excel.support.ExcelTypeEnum;
//
//import javax.servlet.ServletOutputStream;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.net.URLEncoder;
//import java.util.List;
//
///**
// * @Author: ming
// * @Date: 2020/6/12 0012 下午 4:25
// */
//public class EcexlUtils {
//    public static void  export(List<? extends BaseRowModel> list, HttpServletResponse response, Class<? extends BaseRowModel> clazz, String fileName ) {
//
//        ServletOutputStream out = null;
//        try {
//            out = response.getOutputStream();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        ExcelWriter writer = new ExcelWriter(out, ExcelTypeEnum.XLS, true);
//        try {
//
//            Sheet sheet2 = new Sheet(2, 3,clazz, "sheet", null);
//            writer.write(list, sheet2);
//            response.setCharacterEncoding("utf-8");
//            response.setContentType("application/vnd.ms-excel");
//            response.setHeader("content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName+".xls" , "utf-8"));
//            out.flush();
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            writer.finish();
//            try {
//                out.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//
//    }
//
//}
